import mongoose, { Schema } from 'mongoose';

const schema = new Schema(
  {
    jiuquId: { type: String, index: true },
    type: Number,
    resolved: Boolean,
    fromSocialId: { type: String, index: true },
    targetChannel: { type: Schema.Types.ObjectId, ref: 'Channel' },
    createdAt: { type: Date, default: Date.now, index: true },
  },
  {
    collection: 'queue',
  },
);

schema.index({ type: 1, resolved: 1 });

export default mongoose.model('Queue', schema);
